----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 40 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 240
SPELL.m_sName = "Hamstring"
SPELL.m_sToolTip = [[Disables your target, reducing 
					their movement speed by 50% 
					for 6 seconds.]]
SPELL.m_sIcon = "devin/blackbetty/spells/warrior/hamstring.png"
SPELL.m_iCoolDown = 6
SPELL.m_bRequiresTarget = true
SPELL.m_iSpellType = SPELLTYPE_SLOW

---------------------------------------------------------------------------------------

local weapondamage = 20

function SPELL:Cast( pl, target )

	print("Casted "..self.m_sName.."!")
	if(target && target:IsValid() && target != pl) then
		pl:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_KNIFE)
		pl:EmitSound("devin/blackbetty/weapons/hamstring/hamstring_swing.wav", 100, 100+math.random(-10,10))
		if(pl:GetPos():Distance(target:GetPos()) < self.m_iRange)then
			
			timer.Simple(0.01, function()
				pl:EmitSound("devin/blackbetty/weapons/hamstring/hamstring"..math.random(1,3)..".wav", 100, 100+math.random(-10,10))
				--target.SpeedMod = -0.5
				--target.SpeedModDuration = 6
				--target.SpeedType = "Hamstring"
			end)
		end
		timer.Simple(0.25, function()
			pl:SetNWBool("Casting", false)
			pl:SetNWBool("Casted", false)
		end)
	end
end



